JSONIsValid

Returns True or False to indicate if an expression is valid JSON.

Syntax

JSONIsValid("JSON")

Arguments

Argument Description
JSON Expression to evaluate. Must contain a number, string, Boolean, JSONObject, JSONArray, or null to return True.

Strings must be wrapped in backslashes and double quotation marks (\"). For example, x = "\"This is a string\"" is evaluated as a JSON string.

Return value

Value Description
True Expression is valid JSON.
False Expression is not valid JSON.

Example

' Returns True

boolVal = JSONIsValid("{\"propName\":\"propValue\"}")

PrintLn("Should be True: " & boolVal)

' Returns False

boolVal = JSONIsValid("unquoted string")

PrintLn("Should be False: " & boolVal)